import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cached_pdfview/flutter_cached_pdfview.dart';
import '../../../../base/base_state.dart';
import '../../../../base/full_base_page.dart';

class PreviewAttachementPage extends StatefulWidget {
  String? url;

  PreviewAttachementPage({super.key, required this.url});

  @override
  BaseState<PreviewAttachementPage> createState() =>
      _PreviewAttachementPageState();
}

class _PreviewAttachementPageState extends BaseState<PreviewAttachementPage> {
  @override
  FullBasePage buildState(BuildContext context) {
    return FullBasePage(
      title: "试驾协议预览",
      child: widget.url?.startsWith('http://')==true?const PDF(
        swipeHorizontal: false,
      ).cachedFromUrl(widget.url!):const PDF(
        swipeHorizontal: false,
      ).fromPath(widget.url!),
    );
  }
}
